<template>
	<view>
		<view class="status_bar">
		          <!-- 这里是状态栏 -->
		      </view>
		<view class="header borderBottom20">
			<image class="headerBg" src="../../static/img/teacher/center/headerBg.png" mode=""></image>
			<view class="teacherInfo" @click="onNavigateTo('/pages/teacher/teacherInfo')">
				<image :src="info.image" mode=""></image>
				<view class="teacherInfo_name">
					<text>{{info.name}}</text>
					<view style="position: relative;top: 20rpx;">	
						<uni-rate size="20" disabled="true" :value="info.star"></uni-rate>
					</view>
				</view>
			</view>
			<text class="header_title">预约订单</text>
			<view class="orderList" v-if="type==1">
				<view class="order" @click="onNavigateTo('/pages/teacher/teacherOrder?status=0')">
					<image style="width: 40rpx;height: 47rpx;" src="../../static/img/teacher/center/allOrder.png" mode=""></image>
					<view>全部订单</view>
				</view>
				<view class="order" @click="onNavigateTo('/pages/teacher/teacherOrder?status=3')">
					<image style="width: 43rpx;height: 46rpx;" src="../../static/img/teacher/center/noService.png" mode=""></image>
					<view>未服务</view>
				</view>
				<view class="order" @click="onNavigateTo('/pages/teacher/teacherOrder?status=2')">
					<image style="width: 43rpx;height: 43rpx;" src="../../static/img/teacher/center/serviced.png" mode=""></image>
					<view>已服务</view>
				</view>
			</view>
			<view class="orderList" v-if="type==2">
				<view class="order" @click="onNavigateTo('/pages/teacher/testOrder?status=0')">
					<image style="width: 40rpx;height: 47rpx;" src="../../static/img/teacher/center/allOrder.png" mode=""></image>
					<view>全部订单</view>
				</view>
				<view class="order" @click="onNavigateTo('/pages/teacher/testOrder?status=3')">
					<image style="width: 43rpx;height: 46rpx;" src="../../static/img/teacher/center/noService.png" mode=""></image>
					<view>未服务</view>
				</view>
				<view class="order" @click="onNavigateTo('/pages/teacher/testOrder?status=2')">
					<image style="width: 43rpx;height: 43rpx;" src="../../static/img/teacher/center/serviced.png" mode=""></image>
					<view>已服务</view>
				</view>
			</view>
		</view>
		<view class="container">
			<view class="select" @click="onNavigateTo('/pages/teacher/chartsCenter')">
				<view class="select_left">
					<image style="width: 48rpx;height: 48rpx;" src="../../static/img/teacher/center/charts.png" mode=""></image>
					<text>统计中心</text>
				</view>
				<text style="font-size: 40rpx;color: #848488;" class="iconfont">&#xe79a;</text>
			</view>
			<view class="select" @click="onNavigateTo('/pages/teacher/teacherInfo')">
				<view class="select_left">
					<image style="width: 50rpx;height: 46rpx;" src="../../static/img/teacher/center/setting.png" mode=""></image>
					<text>我的资料</text>
				</view>
				<text style="font-size: 40rpx;color: #848488;" class="iconfont">&#xe79a;</text>
			</view>
			<view class="select" @click="onNavigateTo('/pages/teacher/teacherEvaluate')">
				<view class="select_left">
					<image style="width: 47rpx;height: 39rpx;" src="../../static/img/teacher/center/evaluate.png" mode=""></image>
					<text>服务评价</text>
				</view>
				<text style="font-size: 40rpx;color: #848488;" class="iconfont">&#xe79a;</text>
			</view>
			<view class="select" @click="onNavigateTo('/pages/teacher/updatePassword')">
				<view class="select_left">
					<image style="width: 47rpx;height: 39rpx;" src="../../static/img/teacher/center/password.png" mode=""></image>
					<text>修改密码</text>
				</view>
				<text style="font-size: 40rpx;color: #848488;" class="iconfont">&#xe79a;</text>
			</view>
			<view class="footer" @click="signOut">退出登录</view>
		</view>
		
	</view>
</template>

<script>
	import {teacherIndex } from '@/api/teacher/teacherInfo/teacherInfo.js';
	import uniRate from '@/components/uni-rate/uni-rate.vue'
	export default {
		components: {
			uniRate
		},
		data() {
			return {
				info:{},
				type:1,
			};
		},
		async onShow() {
			let res=await teacherIndex()
			this.info=res.data
			this.type=res.data.cartype
		},
		methods:{
			onNavigateTo(url) {
				uni.navigateTo({
					url: url
				});
			},
			signOut(){
				uni.showModal({
				    title: '退出登录',
				    content: '您确定要退出登录吗',
					confirmColor:'#FF0000',
				    success: function (res) {
				        if (res.confirm) {
							uni.removeStorageSync('teacherToken');
				            uni.reLaunch({
									url:'/pages/teacher/login'
				            })
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});
			}
		}
	}
</script>

<style lang="scss">
@import './css/teacherCenter.scss';
</style>
